index.html.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <!-- 头部 -->
  3. <templateHead v-if="skinId <= 4"></templateHead>
  4. <!-- 皮肤5头部 -->
  5. <templateHead5 v-if="skinId == 5"></templateHead5>
  6. <!-- 皮肤6头部 -->
  7. <templateHead6 v-if="skinId == 6"></templateHead6>
  8. <!-- 皮肤7头部 -->
  9. <templateHead7 v-if="skinId==7"></templateHead7>
  10. <!-- 菜单 -->
  11. <templateMenu v-if="skinId <= 4"></templateMenu>
  12. <!-- 皮肤5菜单 -->
  13. <templateMenu5 v-if="skinId >= 5"></templateMenu5>
  14. <!-- 内容 -->
  15. <div v-for="(item, index) in templateData" :key="index">
  16. <!--1.广告通栏-->
  17. <div v-if="item.sectorName == 'adSector'">
  18. <templateAd :skinId="skinId" :adData="adData" :adTag="item.ad.ad_tag"></templateAd>
  19. </div>
  20. <!--2.单页-详情-->
  21. <div v-if="item.sectorName == 'aboutArticleSector'">
  22. <templateAboutDetail :skinId="skinId" :templateData="item.componentList"></templateAboutDetail>
  23. </div>
  24. <!-- 3.皮肤6 单页-详情 -->
  25. <div v-if="item.sectorName == 'aboutArticleupdownSector'">
  26. <templateAboutArticleupdownSector :skinId="skinId" :templateData="item.componentList"></templateAboutArticleupdownSector>
  27. </div>
  28. <!-- 4.皮肤7 单页-详情 -->
  29. <div v-if="item.sectorName == 'aboutDetailSector'">
  30. <templateAboutDetailSector :skinId="skinId" :templateData="item.componentList"></templateAboutDetailSector>
  31. </div>
  32. </div>
  33. <!-- 底部 -->
  34. <templateFoot v-if="skinId <= 4"></templateFoot>
  35. <!-- 皮肤5底部 -->
  36. <templateFoot1 v-if="skinId == 5 || skinId == 6"></templateFoot1>
  37. <!-- 皮肤7底部 -->
  38. <templateFoot2 v-if="skinId==7"></templateFoot2>
  39. </template>
  40. <script setup lang="ts">
  41. //0.加载全局模板组件 start---------------------------------------->
  42. //0.1 全局通栏
  43. // 0.1.1头部
  44. import templateHead from '@/components/template/sector/head/1200x200/1.vue'
  45. import templateHead5 from '@/components/template/sector/head/1200x250/1.vue'
  46. import templateHead6 from '@/components/template/sector/head/1200x250/6.vue'
  47. import templateHead7 from '@/components/template/sector/head/1200x250/7.vue'
  48. // 0.1.2菜单
  49. import templateMenu from '@/components/template/sector/menu/1200x130/1.vue'
  50. import templateMenu5 from '@/components/template/sector/menu/1200x187/1.vue'
  51. // 0.1.3底部
  52. import templateFoot from '@/components/template/sector/foot/1200x580/1.vue'
  53. import templateFoot1 from '@/components/template/sector/foot/1200x680/1.vue'
  54. import templateFoot2 from '@/components/template/sector/foot/1200x700/1.vue'
  55. //0.2 局部通栏
  56. //0.2.1 广告组件
  57. import templateAd from '@/components/template/sector/body/ad/1200x90/1.vue'
  58. //0.2.2 底部详情-详情
  59. import templateAboutDetail from '@/components/template/sector/body/about/1200x1150/1.vue'
  60. //0.2.2 皮肤6 底部详情-详情
  61. import templateAboutArticleupdownSector from '@/components/template/sector/body/about/1200x1334/6/1.vue'
  62. //0.2.3 皮肤7 底部详情-详情
  63. import templateAboutDetailSector from '@/components/template/sector/body/about/1200x1250/1.vue'
  64. //0.加载全局模板组件 end---------------------------------------->
  65. //1.获得基本信息单元 start---------------------------------------->
  66. //1.1获得页面依赖
  67. import { ref, onMounted } from 'vue';
  68. //1.2获得pinia源
  69. import { useTemplateBaseStore } from '@/stores/templateBase'
  70. const templateBaseStore: any = useTemplateBaseStore()
  71. //1.3获得该页的皮肤id - 在每个组件中也是同样的获得方法
  72. const skinId = ref<number>(0)
  73. const websiteId = ref<number>(0)
  74. //1.4获得站点基本信息
  75. const responseStatus = await requestDataPromise('/web/getWebsiteAllinfo', {
  76. method: 'GET',
  77. query: {
  78. 'link_textnum': 24,
  79. 'link_imgnum': 18,
  80. 'link_footnum': 4
  81. },
  82. });
  83. if (responseStatus.code == 200) {
  84. if (responseStatus.data.website_foot.foot_info.status == 1) {
  85. //网站模板已停用,直接转入404页面
  86. navigateTo('/error?findPage=index')
  87. } else {
  88. //0.3.1设置站点基本信息
  89. templateBaseStore.setWebSiteInfo(responseStatus.data)
  90. websiteId.value = responseStatus.data.website_head.id;//获得网站id
  91. //0.3.2设置皮肤id
  92. skinId.value = templateBaseStore.webSiteInfo.website_foot.foot_info.template_id;
  93. console.log("当前的网站id:" + responseStatus.data.website_head.id)
  94. //0.3.3设置seo信息
  95. let seoTitle = templateBaseStore.webSiteInfo.website_head.title;
  96. let seoDescription = templateBaseStore.webSiteInfo.website_head.description;
  97. let seoKeywords = templateBaseStore.webSiteInfo.website_head.keywords;
  98. let seoSuffix = templateBaseStore.webSiteInfo.website_head.suffix;
  99. let seoName = templateBaseStore.webSiteInfo.website_head.website_name;
  100. useHead({
  101. title: seoTitle + "_" + seoSuffix,
  102. meta: [
  103. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  104. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 }
  105. ]
  106. });
  107. }
  108. }
  109. //1.获得基本信息单元 end---------------------------------------->
  110. //2.页面数据 start---------------------------------------->
  111. //2.1获得页面数据
  112. const response = await requestDataPromise('/client/indexData', {
  113. method: 'POST',
  114. body: {
  115. 'website_id': websiteId.value,
  116. 'getpage': 'aloneArticle'
  117. },
  118. });
  119. //页面数据
  120. const templateData = response.data.template.aloneArticle;
  121. //广告数据
  122. const adData = ref<any[]>([]);
  123. adData.value.push(response.data.ad.top)
  124. for (let item of response.data.ad.aloneArticle) {
  125. adData.value.push(item)
  126. }
  127. templateBaseStore.setAdList(adData.value)
  128. //2.页面数据 end---------------------------------------->
  129. </script>
  130. <style lang="less" scoped>
  131. @import '@/assets/css/about.less';
  132. </style>